﻿using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;

namespace WindowsFormsApp1.Docking
{
    public class SolutionExplorer : DockContent
    {
        public SolutionExplorer()
        {
            Text = "解决方案资源管理器";
            TabText = "解决方案资源管理器";
            var tree = new TreeView
            {
                Dock = DockStyle.Fill,
                BackColor = System.Drawing.Color.FromArgb(37, 37, 38),
                ForeColor = System.Drawing.Color.White,
                BorderStyle = BorderStyle.None,
                ImageList = new ImageList
                {
                    ColorDepth = ColorDepth.Depth32Bit
                }
            };

            // 添加图标（需要实际图片资源）
            //tree.ImageList.Images.Add(Properties.Resources.SolutionIcon);
            //tree.ImageList.Images.Add(Properties.Resources.ProjectIcon);
            //tree.ImageList.Images.Add(Properties.Resources.CSharpIcon);

            var solutionNode = new TreeNode("Solution 'MySolution' (1 project)", 0, 0);
            solutionNode.Nodes.Add(new TreeNode("MyProject.csproj", 1, 1)
            {
                Nodes = {
                    new TreeNode("Program.cs", 2, 2),
                    new TreeNode("MainForm.cs", 2, 2)
                }
            });

            tree.Nodes.Add(solutionNode);
            Controls.Add(tree);
        }
    }
}
